-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix suggestions with multiple corrections #129
base: master
Are you sure you want to change the base?
Conversation
849d8bb
to
892a6f7
Compare
We're using this branch now as we think that the change is working well. Unfortunately this is not well covered by tests (yet) though, so if someone is able to help ot there, feel free to reach out. Anyone who's relying on this, feel free to use our fork's branch until this is merged. If you see any issues, please post them here. |
@haya14busa I think I fixed the issue and verified with a local devcontainer setup (see PR #130 ) |
can we trigger the workflows again? we're using this for 2 weeks now for most of our repos without a problem and we would like to see this in upstream |
@@ -90,23 +90,44 @@ def build_range(offense) | |||
# @param [RuboCop::Cop::Offense] offense | |||
# @return [Array{Hash}] | |||
def build_suggestions(offense) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has two Rubocop metrics based warnings since it's a larger method now. Perhaps determining the positions/range and sorted corrections could each be extracted into a private method?
We don't see to have tests for this other than integration tests through Rubocop CLI. If its easier to write a unit test that would be fine but is there anyway we could update the test data with samples that would trigger the warnings before this change and then include it here to demonstrate that the fix is working as expected?
The suggestions feature is broken as it's ignoring any offenses with multiple corrections. This is leading to wrong or - at best - incomplete sugggestions.
Fixes #81 and #96
Examples (before fix):
Examples (with fix):